package nongchang.kuaijiecaifu.com.ncapp_android.common.fragment;


import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;


public abstract class RecyclerViewFragment extends BaseFragment  {
    private ListView _listview;

    public ListView getListView() {
        return _listview;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        ListView listview = new ListView(container.getContext());
        listview.setId(android.R.id.list);
        listview.setDivider(null);
        listview.setLayoutParams(lp);
        return listview;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        _listview = (ListView)getView().findViewById(android.R.id.list);
        onLoad();
    }

    public abstract void onLoad();


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        _listview.setAdapter(null);
    }

}
